import os

filenames = os.listdir('.')


any(name.endswith('.pyc') for name in filenames) # 任意一个True就返回True

from urllib.request import urlopen

def read_data(name):
    if name.startswith(('http:', 'https:', 'ftp:')):# startswith，endwiths跟的是元祖
        return urlopen(name).read()
    else:
        with open(name) as f:
            return f.read()